package com.vader.boot.scope;

import lombok.extern.slf4j.Slf4j;
import org.apache.catalina.core.ApplicationContext;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;

/**
 * @author Vader
 * @date 2022/5/24
 **/
//@SpringBootApplication
@Slf4j
@ComponentScan
public class ScopeApplicationContext {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ScopeApplicationContext.class);

        BeanForSingleton bean = context.getBean(BeanForSingleton.class);
        log.info("bean:{}",bean.getProperty().getClass());
        log.info("bean:{}",bean.getProperty());
        log.info("bean:{}",bean.getProperty());
        log.info("bean:{}",bean.getProperty());

        context.close();
    }
}
